<extend name="common:commonTemplate" />
<block name="main_content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="index.html"
				data-original-title="Go to Home"><i class="icon-home"></i> 首页</a> <a
				href="#">页面资源管理</a> <a class="current" href="#">页面资源管理信息列表</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-info-sign"></i>
						</span>
						<h5>页面资源管理信息</h5>
					</div>
					<div class="widget-content nopadding">
						<form novalidate="novalidate" id="basic_validate"
							name="basic_validate" action="#" method="post"
							class="form-horizontal">
							<div class="control-group">
								<label class="control-label">菜单名称</label>
								<div class="controls">
									<input type="text" id="menu_name" name="menu_name"/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">页面等级</label>
								<div class="controls">
								<select id="level" >
									<option value="1">一级菜单</option>
									<option value="2">二级菜单</option>
								</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">菜单域</label>
								<div class="controls">	
									<select id="menu_domain" >
									   <option value="">---请选择---</option>
									   <volist name="lst_menu_domain" id="parent_domain">
											<option value="{$parent_domain.domain_url}">{$parent_domain.domain_name}</option>
										</volist>
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">菜单链接</label>
								<div class="controls">
									<input type="text" id="menu_url" name="menu_url"/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">父节点</label>
								<div class="controls">
								<select id="parent_id" >
									<option value="">---请选择---</option>
								   	<volist name="lst_menu_resource" id="parent_menu">
										<option value="{$parent_menu.menu_id}">{$parent_menu.menu_name}</option>
									</volist>
								</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">是否显示</label>
								<div class="controls">
									<select id="menu_display" name="menu_display">
					                  <option value="1">显示</option>
					                  <option value="0">不显示</option>
					                </select>
								</div>
							</div>
							<div class="control-group">
								<a id="btn_addMenuResource" class="btn btn-success">新增页面资源管理</a> 
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</block>


<block name="js_content"> <script>
		//新增页面资源管理
		$('#btn_addMenuResource').bind('click', function(){
			var menu_name = $('#menu_name').val();
			var menu_domain = $('#menu_domain').val();
			var menu_url = $('#menu_url').val();
			var parent_id = $('#parent_id').val();
			var level = $('#level').val();
			var default_url = $('#default_url').val();
			var menu_display = $('#menu_display').val();
			if(menu_domain ==''){
				alert("菜单域为必填项!!!");
				return;
			}
			if(level ==2){
				if(parent_id ==''){
					alert("二级菜单,父节点必填!!!");
					return;
				}
			}else{
				if(parent_id !=''){
					alert("一级菜单,父节点不可填!!!");
					return;
				}
			}
			var result = AuthService.AddMenuResource(menu_name,menu_domain,menu_url,parent_id,level,menu_display);
			if (result.IsSuccess == 0) {
				alert(result.ErrorMsg);
				return;
			} else {
				alert('操作成功');
				$('#promoter_status').text('有效');
			}
		});
</script> </block>